# -*- coding: utf-8 -*-
import math

from collections import namedtuple
from odoo import api, fields, models, SUPERUSER_ID, tools
from odoo.addons.resource.models.resource import float_to_time, HOURS_PER_DAY

from datetime import datetime, date, timedelta, time
from pytz import timezone, UTC

from odoo.exceptions import UserError

DummyAttendance = namedtuple('DummyAttendance', 'hour_from, hour_to, dayofweek, day_period, week_type')

class HrEmployee(models.Model):
    _inherit = 'hr.employee'
    def get_employee_monthly_leave(self,date_start,date_end):
        leaves=self.env['hr.leave.line'].search([('date','>=',date_start),('date','<=',date_end),('leave_type','=','1')])
        leaves_2 = self.env['hr.leave.line'].search(
            [('date', '>=', date_start), ('date', '<=', date_end), ('leave_type', '=', '2')])
        leave1=0
        leave2=0
        if leaves:
            leave1=sum(l.hours for l in leaves)

        if leaves_2:
            leave2=sum(l.hours for l in leaves_2)
        return leave1,leave2

